//
//  FGYThirdView.m
//  01 - shop
//
//  Created by ma c on 16/8/18.
//  Copyright (c) 2016年 beijing. All rights reserved.
//

#import "FGYThirdView.h"

@interface FGYThirdView ()

@property (strong, nonatomic) UIButton * qqBtn;
@property (strong, nonatomic) UIButton * weixinBtn;
@property (strong, nonatomic) UIButton * sinaBtn;
@property (strong, nonatomic) UILabel * lineLabel;//分割线
@property (strong, nonatomic) UILabel * textLabel;//一键登录

@end

@implementation FGYThirdView

- (UILabel *)lineLabel{
    if (!_lineLabel) {
        _lineLabel = [[UILabel alloc]init];
        _lineLabel.backgroundColor = RGB(228, 228, 228);
    }
    return _lineLabel;
}

- (UILabel *)textLabel{
    if (!_textLabel) {
        _textLabel = [[UILabel alloc]init];
        _textLabel.text = @"一键登录";
        _textLabel.textAlignment = NSTextAlignmentCenter;
        _textLabel.backgroundColor = RGB(245, 245, 245);
        _textLabel.textColor = RGB(204, 204, 204);
    }
    return _textLabel;
}

- (UIButton *)weixinBtn{
    if (!_weixinBtn) {
        _weixinBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_weixinBtn setBackgroundImage:[UIImage imageNamed:@"登录界面微信登录"] forState:UIControlStateNormal];
    }
    return _weixinBtn;
}

- (UIButton *)qqBtn{
    if (!_qqBtn) {
        _qqBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_qqBtn setBackgroundImage:[UIImage imageNamed:@"登录界面qq登陆"] forState:UIControlStateNormal];
    }
    return _qqBtn;
}

- (UIButton *)sinaBtn{
    if (!_sinaBtn) {
        _sinaBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_sinaBtn setBackgroundImage:[UIImage imageNamed:@"登陆界面微博登录"] forState:UIControlStateNormal];
    }
    return _sinaBtn;
}



- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self addSubview:self.lineLabel];
        [self addSubview:self.textLabel];
        [self addSubview:self.qqBtn];
        [self addSubview:self.weixinBtn];
        [self addSubview:self.sinaBtn];
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    __weak typeof(self)weakSelf = self;
    [_lineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(weakSelf.mas_left).offset(16);
        make.right.equalTo(weakSelf.mas_right).offset(-16);
        make.top.equalTo(weakSelf.mas_top).offset(16);
        make.height.equalTo(@1);
    }];
    
    [_textLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(weakSelf.lineLabel.mas_centerX);
        make.centerY.equalTo(weakSelf.lineLabel.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(100, 16));
    }];
    
    [_weixinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(weakSelf.mas_centerX);
        make.top.equalTo(weakSelf.lineLabel.mas_bottom).offset(40);
        make.size.mas_equalTo(CGSizeMake(60, 60));
        
    }];
    
    [_qqBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(weakSelf.weixinBtn);
        make.top.equalTo(weakSelf.lineLabel.mas_bottom).offset(40);
        make.right.equalTo(weakSelf.weixinBtn.mas_left).offset(-50);
    }];
    [_sinaBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.height.equalTo(weakSelf.weixinBtn);
        make.top.equalTo(weakSelf.lineLabel.mas_bottom).offset(40);
        make.left.equalTo(weakSelf.weixinBtn.mas_right).offset(50);
    }];
}

@end
